<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.prime.com.tr/ui"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head>
	<style type="text/css">
.marcar {
	width: 50px;
	text-align: center;
}

.classe {
	width: 150px;
	text-align: left;
}

.familia {
	width: 150px;
	text-align: left;
}

.gene {
	width: 150px;
	text-align: left;
}

.inicio {
	width: 50px;
	text-align: center;
}

.fim {
	width: 50px;
	text-align: center;
}

.complementar {
	width: 50px;
	text-align: right;
}

</style>
</h:head>
<h:body onload="foco();">
	<ui:composition template="../template.xhtml">
		<ui:define name="miolo">
   			<p:growl id="erros"/> 
			<h:form id="LSAnalise">
				<p:panel id="panel" header="#{msgs.manintenaceAnalysis}">
					<table width="100%">
						<tr valign="middle">
							<td width="40px" align="left"><p:commandButton
									value="#{msgs.register}" action="#{analiseFrm.cadastrar}" />
							</td>
						</tr>
					</table>
					<table>
						<tr>
							<td><h:outputText value="Gene:" /> &nbsp; <h:selectOneMenu
									styleClass="select" id="arquivoFasta"
									value="#{analiseFrm.arquivoFastaSelecionado}">
									<f:selectItems value="#{analiseFrm.arquivosFasta}" />
								</h:selectOneMenu> &nbsp; <p:commandButton id="btPesquisar" image="ui-icon-search"
									value="#{msgs.search}" action="#{analiseFrm.pesquisar}"
									update="tabela,erros" />
							</td>
						</tr>
					</table>
					<table width="100%">
						<tr>
							<td><h:panelGrid style="width:100%">
									<p:dataTable value="#{analiseFrm.colecaoAnalise}"
										emptyMessage="#{msgs.naoHaDados}" id="tabela" 
										var="item" paginator="true" rows="10"
										paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"  
        								rowsPerPageTemplate="10,20,50">

										<p:column styleClass="marcar">
											<f:facet name="header">
												<h:outputText value="#{msgs.markColumn}" />
											</f:facet>
											<h:selectBooleanCheckbox id="marcar" value="#{item.marcar}" />
										</p:column>

										<p:column sortBy="#{item.classe}" styleClass="classe">
											<f:facet name="header">
												<h:outputText value="#{msgs.columnClass}" />
											</f:facet>
											<h:outputText value="#{item.classe}" />
										</p:column>

										<p:column sortBy="#{item.familia.descricao}"
											styleClass="familia">
											<f:facet name="header">
												<h:outputText value="#{msgs.familyColumn}" />
											</f:facet>
											<h:outputText value="#{item.familia.descricao}" />
										</p:column>

										<p:column sortBy="#{item.gene}" styleClass="gene">
											<f:facet name="header">
												<h:outputText value="GENE" />
											</f:facet>
											<h:outputText value="#{item.gene.name}" />
										</p:column>

										<p:column sortBy="#{item.inicio}" styleClass="inicio">
											<f:facet name="header">
												<h:outputText value="#{msgs.startColumn}" />
											</f:facet>
											<h:outputText value="#{item.inicio}" />
										</p:column>

										<p:column sortBy="#{item.fim}" styleClass="fim">
											<f:facet name="header">
												<h:outputText value="#{msgs.endColumn}" />
											</f:facet>
											<h:outputText value="#{item.fim}" />
										</p:column>

										<p:column sortBy="#{item.complementar}"
											styleClass="complementar">
											<f:facet name="header">
												<h:outputText value="#{msgs.tapeColumn}" />
											</f:facet>
											<h:outputText
												value="#{item.complementar == 'C' ? '-' : item.complementar}" />
										</p:column>
										
										<p:column sortBy="#{item.complementar}"
											styleClass="complementar">
											<f:facet name="header">
												<h:outputText value="#{msgs.localizacao}" />
											</f:facet>
											<h:outputText
												value="#{item.localizacao}" />
										</p:column>

									</p:dataTable>
								</h:panelGrid>
							</td>
						</tr>
						<tr>
							<td><h:panelGrid style="width:100%">
									<p:panel header="#{msgs.exportColumn}">
										<h:commandLink>
											<p:graphicImage title="#{msgs.exportColumn} Excel"
												value="../images/excel.png" />
											<p:dataExporter type="xls" target="tabela" fileName="Resumo"
												excludeColumns="0" />
										</h:commandLink>

										<h:commandLink>
											<p:graphicImage title="#{msgs.exportColumn} PDF"
												value="../images/pdf.png" />
											<p:dataExporter type="pdf" target="tabela" fileName="Resumo"
												excludeColumns="0" />
										</h:commandLink>

										<h:commandLink>
											<p:graphicImage title="#{msgs.exportColumn} CSV"
												value="../images/csv.png" />
											<p:dataExporter type="csv" target="tabela" fileName="Resumo"
												excludeColumns="0" />
										</h:commandLink>

										<h:commandLink>
											<p:graphicImage title="#{msgs.exportColumn} XML"
												value="../images/xml.png" />
											<p:dataExporter type="xml" target="tabela" fileName="Resumo"
												excludeColumns="0" />
										</h:commandLink>

										<h:commandLink title="#{msgs.exportColumn} Fasta"
											action="#{analiseFrm.gerar}">
											<p:graphicImage value="../images/download.png" />
										</h:commandLink>
									</p:panel>
								</h:panelGrid>
							</td>
						</tr>
					</table>
				</p:panel>
			</h:form>
		</ui:define>
	</ui:composition>
</h:body>
</html>


